package com.eascs.workflow.org.dao.impl;

import org.springframework.stereotype.Repository;

import com.eascs.workflow.common.dao.BaseDao;
import com.eascs.workflow.org.dao.OrganDao;
import com.eascs.workflow.org.entity.Organ;

@Repository
public class OrganDaoImpl extends BaseDao implements OrganDao {

	@Override
	public Organ getOrgByUnitNo(String unitNo) {
		String sql = "select o.id as orgId,o.org_name as orgName,o.parent_id as parentId,o.unit_no as unitNo,o.`level` as level from act_org o where o.unit_no = ?";
		return this.workflowJdbcSession.findEntity(sql, Organ.class, unitNo);
	}

	@Override
	public Organ getOrgByOrgId(String orgId) {
		String sql = "select o.id as orgId,o.org_name as orgName,o.parent_id as parentId,o.unit_no as unitNo,o.`level` as level from act_org o where o.id = ?";
		return this.workflowJdbcSession.findEntity(sql, Organ.class, orgId);
	}

}
